package com.cc.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.cbor.MappingJackson2CborHttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.nio.charset.Charset;
import java.util.List;

/**
 * @author 33314
 * @version 1.0
 * @description: TODO
 * @date 2025/6/10 19:16
 */
@Configuration//配置类
@ComponentScan("com.cc.controller")//扫描controller包
@EnableWebMvc//启用SpringMVC
public class SpringMVCConfig implements WebMvcConfigurer {
/**
 * @description: TODO
 * @author 消息转换为utf-8格式
 * @date
 * @version 1.0
 */
    @Override
    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
        MappingJackson2HttpMessageConverter  converter = new MappingJackson2HttpMessageConverter();
        converter.setDefaultCharset(Charset.forName("utf-8"));
        converters.add(converter);
    }
}
